<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<%@include file="/WEB-INF/views/include/head.jsp" %>
	<title>监测点</title>
	<style type="text/css">
		.jqGrid_wrapper{padding:0;margin: 0}
		.panel-right{position: absolute;display: inline-block;margin-left: 92%;margin-top:-18px}
		.a-cz  {color: black;font-size: 16px}
	</style>
	<script type="text/javascript">
		var myGrid;
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		$(document).ready(function() {
			if(isIE)height=height-10;
			// 跨iframe访问数据
			var officeType3IdTmp = top.frames["${frame}"].oaNotifyFormObj.officeType3IdTmp;
			//var officeType3IdTmp = top.find('iframe')[0].contentWindow.$("#jqGrid");
			myGrid=$("#jqGrid").jqGrid({
                url: '${ctx}/oa/oaNotify/loadUserData?&code=crest',
                mtype: "POST",
                datatype: "json",
                responsive:true,
                page: 1,
                postData : {
                	type : 3
                },
                colModel: [
					{ label: 'id', name: 'id', key: true, hidden:true},
					// 监测点
					{ label: '负责人',index:'a.name',name: 'name', width: 75 },
                    { label: '监测点',index:'o.name',name: 'office.name', width: 75 },
					{ label: '地区',index:'oa.name',name: 'office.area.name', width: 75 }
                ],
				viewrecords: true,
                rowNum: 10,
                rowList:[10,20,30],
                loadonce:false,
                multiselect: true, // 显示多选复选框
                autowidth: true,
                height : height-20,
                pager: "#jqGridPager",
               	onSelectAll : function(aRowids, status){
               		// 事件：全选
               		var officeType3Name;
               		if(!aRowids){
               			aRowids = [];
               		}
               		var key, rowid;
               		for(key in aRowids ){
               			rowid = aRowids[key];
               			if(status){
               				officeType3Name = $('#jqGrid').jqGrid('getCell', rowid, 'name');
               				officeType3IdTmp[rowid] = officeType3Name;
                   		}else{
                   			delete officeType3IdTmp[rowid];
                   		}
               		}
               	},
               	onSelectRow : function(rowid, status){
               		// 事件：选中数据
               		var officeType3Name;
               		if(status){
               			officeType3Name = $('#jqGrid').jqGrid('getCell', rowid, 'name');
               			officeType3IdTmp[rowid] = officeType3Name;
               		}else{
               			delete officeType3IdTmp[rowid];
               		}
               	},
               	loadComplete : function(xhr){
               		// 事件：加载数据
               		var index, id, rows = xhr.rows;
               		for(index in rows){
               			id = rows[index].id;
               			if(!!officeType3IdTmp[id])
               				$("#jqGrid").jqGrid('setSelection', id);
               		}
               	}
            });
			
			$('#jqGrid').jqGrid('filterToolbar',{
				stringResult:true, 
				searchOnEnter:true, 
				defaultSearch:'cn'
			});
			
			$("#jqGrid").jqGrid('navGrid','#jqGridPager', {
				edit:false,
				add:false,
				del:false,
				search:false
			});
			
			$(window).bind("resize", function(){
				var width = $(".jqGrid_wrapper").width();
				$("#jqGrid").setGridWidth(width);
			});
		});
	</script>
</head>
<body >
	<div class="jqGrid_wrapper">
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
	</div>
</body>
</html>